/*
 * Eliminacion.java
 *
 * Creada el 3 de marzo de 2008, 19:48 PM
 *
 */

package FachadaDatos;

import CapaLogica.*;
import com.sun.crypto.provider.RSACipher;
import java.util.*;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import FachadaInterfaz.*;

/**
 *
 * @author Solware
 */
public class Eliminacion {
    
    /** Crea una nueva instancia de Eliminacion */
    public static int eliminarSolicitud(int id) throws SQLException {
    
        
        Conexion.conectar();
        Statement stmt = Conexion.conexion.createStatement();
        
        try {
        ResultSet rst =
                stmt.executeQuery("DELETE FROM solicitud WHERE (id = '"+id+"');");
                
        } catch (SQLException ex) {
            if (!ex.getSQLState().equals("02000")) {
                throw new SQLException("No se pudo eliminar en la BD.", ex.getSQLState());
            }
        }
        
        return 0;
    }
    
    public static int eliminarSeccion(int id) throws SQLException {
    
        
        Conexion.conectar();
        Statement stmt = Conexion.conexion.createStatement();
        
        try {
        ResultSet rst =
                stmt.executeQuery("DELETE FROM seccion WHERE (id = '"+id+"');");
                
        } catch (SQLException ex) {
            if (!ex.getSQLState().equals("02000")) {
                throw new SQLException("No se pudo eliminar en la BD.", ex.getSQLState());
            }
        }
        
        return 0;
    }
    
    public static int eliminarPerfil(int id) throws SQLException {
    
        
        Conexion.conectar();
        Statement stmt = Conexion.conexion.createStatement();
        
        try {
        ResultSet rst =
                stmt.executeQuery("DELETE FROM perfil WHERE (id = '"+id+"');");
                
        } catch (SQLException ex) {
            if (!ex.getSQLState().equals("02000")) {
                throw new SQLException("No se pudo eliminar en la BD.", ex.getSQLState());
            }
        }
        
        return 0;
    }
    
    public static int eliminarServicio(int id) throws SQLException {
    
        
        Conexion.conectar();
        Statement stmt = Conexion.conexion.createStatement();
        
        try {
        ResultSet rst =
                stmt.executeQuery("DELETE FROM servicio WHERE (id = '"+id+"');");
                
        } catch (SQLException ex) {
            if (!ex.getSQLState().equals("02000")) {
                throw new SQLException("No se pudo eliminar en la BD.", ex.getSQLState());
            }
        }
        
        return 0;
    }
    
     public static int eliminarRecurso(int id) throws SQLException {
    
        
        Conexion.conectar();
        Statement stmt = Conexion.conexion.createStatement();
        
        try {
        ResultSet rst =
                stmt.executeQuery("DELETE FROM recurso WHERE (id = '"+id+"');");
                
        } catch (SQLException ex) {
            if (!ex.getSQLState().equals("02000")) {
                throw new SQLException("No se pudo eliminar en la BD.", ex.getSQLState());
            }
        }
        
        return 0;
    }
     
     public static int eliminarUsuario(int id) throws SQLException {
    
        
        Conexion.conectar();
        Statement stmt = Conexion.conexion.createStatement();
        
        try {
        ResultSet rst =
                stmt.executeQuery("DELETE FROM usuario_servidor WHERE (id = '"+id+"');");
                
        } catch (SQLException ex) {
            if (!ex.getSQLState().equals("02000")) {
                throw new SQLException("No se pudo eliminar en la BD.", ex.getSQLState());
            }
        }
        
        return 0;
    }
    
     public static int eliminarDepartamento(int id) throws SQLException {
    
        
        Conexion.conectar();
        Statement stmt = Conexion.conexion.createStatement();
        
        try {
        ResultSet rst =
                stmt.executeQuery("DELETE FROM departamento WHERE (id = '"+id+"');");
                
        } catch (SQLException ex) {
            if (!ex.getSQLState().equals("02000")) {
                throw new SQLException("No se pudo eliminar en la BD.", ex.getSQLState());
            }
        }
        
        return 0;
    }
    
     public static int eliminarMarca(int id) throws SQLException {
    
        
        Conexion.conectar();
        Statement stmt = Conexion.conexion.createStatement();
        
        try {
        ResultSet rst =
                stmt.executeQuery("DELETE FROM marca_recurso WHERE (id = '"+id+"');");
                
        } catch (SQLException ex) {
            if (!ex.getSQLState().equals("02000")) {
                throw new SQLException("No se pudo eliminar en la BD.", ex.getSQLState());
            }
        }
        
        return 0;
    }
     
      public static int eliminarTipoSolicitante(int id) throws SQLException {
    
        
        Conexion.conectar();
        Statement stmt = Conexion.conexion.createStatement();
        
        try {
        ResultSet rst =
                stmt.executeQuery("DELETE FROM tipo_solicitante WHERE (id = '"+id+"');");
                
        } catch (SQLException ex) {
            if (!ex.getSQLState().equals("02000")) {
                throw new SQLException("No se pudo eliminar en la BD.", ex.getSQLState());
            }
        }
        
        return 0;
    }
      
      public static int eliminarTipoRecurso(int id) throws SQLException {
    
        
        Conexion.conectar();
        Statement stmt = Conexion.conexion.createStatement();
        
        try {
        ResultSet rst =
                stmt.executeQuery("DELETE FROM tipo_recurso WHERE (id = '"+id+"');");
                
        } catch (SQLException ex) {
            if (!ex.getSQLState().equals("02000")) {
                throw new SQLException("No se pudo eliminar en la BD.", ex.getSQLState());
            }
        }
        
        return 0;
    }
      
        public static int eliminarEstado(int id) throws SQLException {
    
        
        Conexion.conectar();
        Statement stmt = Conexion.conexion.createStatement();
        
        try {
        ResultSet rst =
                stmt.executeQuery("DELETE FROM estado WHERE (id = '"+id+"');");
                
        } catch (SQLException ex) {
            if (!ex.getSQLState().equals("02000")) {
                throw new SQLException("No se pudo eliminar en la BD.", ex.getSQLState());
            }
        }
        
        return 0;
    }
        
          public static int eliminarPrioridad(int id) throws SQLException {
    
        
        Conexion.conectar();
        Statement stmt = Conexion.conexion.createStatement();
        
        try {
        ResultSet rst =
                stmt.executeQuery("DELETE FROM prioridad WHERE (id = '"+id+"');");
                
        } catch (SQLException ex) {
            if (!ex.getSQLState().equals("02000")) {
                throw new SQLException("No se pudo eliminar en la BD.", ex.getSQLState());
            }
        }
        
        return 0;
    }
}